package FirstHomeworks;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

import org.testng.Assert;
import org.testng.annotations.Test;

import java.util.concurrent.TimeUnit;


/**
 * Created by Yulia on 18.03.14.
 */
public class Lesson4Homework {

    @Test
    public void searchSites(){
        WebDriver driver = new FirefoxDriver();
        driver.get("https://ru.wikipedia.org/wiki/Maven");
        System.out.println("Site1 is opened");

        driver.findElement(By.linkText("Maven search engine")).click();
        System.out.println("Redirected to Site2");

        driver.findElement(By.linkText("Apache Software Foundation")).click();
        System.out.println("Redirected to Site3");

        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        driver.getPageSource().contains("Latest News");
        System.out.println("Text is is present");

//        Assert.assertEquals("Latest News", driver.findElement(By.cssSelector("#news_feed>h3"))
//                .getText());

        driver.quit();
        System.out.println("Browser closed");

    }
}